﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                    xmlns:phoneExt="clr-namespace:Phone.Framework.Behaviors;assembly=Phone.Framework"
                    xmlns:phoneConverters="clr-namespace:Phone.Framework.Converters;assembly=Phone.Framework"
                    xmlns:sys="clr-namespace:System;assembly=mscorlib"
                    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
                    xmlns:cal="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro">

    <phoneConverters:ResourceConverter x:Key="ResourceConverter"/>
    <phoneConverters:CollapseWhenEmptyConverter x:Key="CollapseWhenEmptyConverter"/>
    <phoneConverters:CollapsedWhenStringNullConverter x:Key="CollapsedWhenStringNullConverter" />
    
    <phoneConverters:TransparentBrushWhenEmptyConverter x:Key="TransparentBrushWhenEmptyConverter"/>
    
    <DataTemplate  x:Key="cetDT">
        <Border Background="{Binding CetLevel, Converter={StaticResource TransparentBrushWhenEmptyConverter}}"
                VerticalAlignment="Center" Width="50" Height="50">
            <StackPanel Visibility="{Binding CetLevel, Converter={StaticResource CollapseWhenEmptyConverter}}">
                <TextBlock HorizontalAlignment="Center"
                               Text="CET" Foreground="White"
                               FontSize="{StaticResource PhoneFontSizeSmall}"/>
                <TextBlock HorizontalAlignment="Center"
                               Text="{Binding CetLevel}"
                               Foreground="White"
                               FontSize="{StaticResource PhoneFontSizeMedium}"/>
            </StackPanel>
        </Border>
    </DataTemplate>

    <!--Begin WordTemplate-->

    <DataTemplate x:Key="Simple">
        <TextBlock Text="{Binding Name}"
                   FontSize="{StaticResource PhoneFontSizeExtraLarge}"
                   FontWeight="Bold"
                   cal:Action.TargetWithoutContext="{Binding DataContext, ElementName=mainPage}"
                   cal:Message.Attach="[Event Tap] = [Action OnTap()]">
               <i:Interaction.Behaviors>
                   <phoneExt:BindListBoxItemActionBehavior />
               </i:Interaction.Behaviors>
        </TextBlock>
    </DataTemplate>
    <!--FontWeight="Bold"-->

    <DataTemplate x:Key="Normal">
        <StackPanel Orientation="Horizontal" Margin="0,5">
            <ContentControl Content="{Binding}" ContentTemplate="{StaticResource cetDT}"/>
            <TextBlock Margin="5,0,0,0"
                       Text="{Binding Name}"
                       VerticalAlignment="Center"
                       FontSize="{StaticResource PhoneFontSizeExtraLarge}"
                       cal:Action.TargetWithoutContext="{Binding DataContext, ElementName=mainPage}"
                       cal:Message.Attach="[Event Tap] = [Action OnTap()]">
               <i:Interaction.Behaviors>
                   <phoneExt:BindListBoxItemActionBehavior />
               </i:Interaction.Behaviors>
            </TextBlock>
            <TextBlock Margin="10,0,0,0" VerticalAlignment="Center" Grid.Column="1"
                       Text="{Binding Pron,StringFormat=[\{0\}]}" Foreground="{StaticResource PhoneAccentBrush}"/>
        </StackPanel>
    </DataTemplate>

    <DataTemplate x:Key="Detailed">
        <Grid Margin="0,5">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <StackPanel Orientation="Horizontal">
                <ContentControl Content="{Binding}" ContentTemplate="{StaticResource cetDT}"/>

                <TextBlock Text="{Binding Name}"
                           Margin="5,0,0,0"
                           VerticalAlignment="Center"
                           FontSize="{StaticResource PhoneFontSizeExtraLarge}"
                           FontWeight="Bold"
                           cal:Action.TargetWithoutContext="{Binding DataContext, ElementName=mainPage}"
                           cal:Message.Attach="[Event Tap] = [Action OnTap()]">
               <i:Interaction.Behaviors>
                   <phoneExt:BindListBoxItemActionBehavior />
               </i:Interaction.Behaviors>
                </TextBlock>
                <TextBlock Margin="10,0,0,0" VerticalAlignment="Center" Grid.Column="1" Text="{Binding Pron,StringFormat=[\{0\}]}" Foreground="{StaticResource PhoneAccentBrush}"/>
                <!--<phoneExt:RoundButton Margin="15,0,0,0"
                                      ImageSource="/Resources/Icons/voice.png"
                                      cal:Action.TargetWithoutContext="{Binding DataContext,ElementName=mainPage}"
                                      cal:Message.Attach="[Event Click] = [Action PlayVoice($this)]"
                                      VerticalAlignment="Center" />-->
            </StackPanel>

            <TextBlock Grid.Row="1" TextWrapping="Wrap" Grid.ColumnSpan="2" Text="{Binding Explain}" Foreground="{StaticResource PhoneDisabledBrush}"/>
        </Grid>
        <!--<StackPanel Orientation="Horizontal"
                                    Margin="0,0,0,5">

                                <TextBlock Margin="5,0,0,0"
                                           cal:Message.Attach="[Event Tap] = [Action SearchWithYoudao()]"
                                           cal:View.Model="{Binding DataContext,ElementName=mainPage}"
                                           Text="{Binding Name}"
                                           FontSize="56"
                                           HorizontalAlignment="Center"
                                           VerticalAlignment="Center">
                                    <i:Interaction.Behaviors>
                                        <phoneExt:HighlightTextBehavior Key="{Binding Text,ElementName=searchBox}" />
                                    </i:Interaction.Behaviors>
                                </TextBlock>
                            </StackPanel>-->
    </DataTemplate>

    <!--End WordTemplate-->

    <ControlTemplate x:Key="tileDT">

        <Border Background="{StaticResource PhoneAccentBrush}"
                Margin="12,12,0,0"
                Width="{TemplateBinding Width}"
                Height="125">
            <TextBlock Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content}"
                       Margin="8,8,8,6"
                       FontFamily="{StaticResource PhoneFontFamilyNormal}"
                       FontSize="{StaticResource PhoneFontSizeLarge}"
                       TextWrapping="Wrap"
                       LineStackingStrategy="BlockLineHeight"
                       LineHeight="32"></TextBlock>
        </Border>
    </ControlTemplate>

    <!--<Style TargetType="ListBoxItem">
        <Setter Property="Padding"
                Value="3" />
        <Setter Property="HorizontalContentAlignment"
                Value="Left" />
        <Setter Property="VerticalContentAlignment"
                Value="Top" />
        <Setter Property="Background"
                Value="Transparent" />
        <Setter Property="BorderThickness"
                Value="1" />
        <Setter Property="TabNavigation"
                Value="Local" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">
                    <Grid Background="{TemplateBinding Background}">
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="Normal" />
                                <vsm:VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="fillColor"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0"
                                                         To=".35" />
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="contentPresenter"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0"
                                                         To=".55" />
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="SelectionStates">
                                <vsm:VisualState x:Name="Unselected" />
                                <vsm:VisualState x:Name="Selected">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="fillColor2"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0"
                                                         To=".75" />
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="FocusStates">
                                <vsm:VisualState x:Name="Focused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement"
                                                                       Storyboard.TargetProperty="Visibility"
                                                                       Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Unfocused" />
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>
                        <Rectangle x:Name="fillColor"
                                   Opacity="0"
                                   Fill="#FFBADDE9"
                                   IsHitTestVisible="False"
                                   RadiusX="1"
                                   RadiusY="1" />
                        <Rectangle x:Name="fillColor2"
                                   Opacity="0"
                                   Fill="#FFBADDE9"
                                   IsHitTestVisible="False"
                                   RadiusX="1"
                                   RadiusY="1" />
                        <ContentPresenter x:Name="contentPresenter"
                                          Content="{TemplateBinding Content}"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          HorizontalAlignment="{TemplateBinding 

HorizontalContentAlignment}"
                                          Margin="{TemplateBinding Padding}" />
                        <Rectangle x:Name="FocusVisualElement"
                                   Stroke="#FF6DBDD1"
                                   StrokeThickness="1"
                                   Visibility="Collapsed"
                                   RadiusX="1"
                                   RadiusY="1" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>-->

</ResourceDictionary>